
import Vue from 'vue';
import {HttpAuthInterceptor} from '../interceptors/http-auth.intcp';
import {HttpSessionInterceptor} from '../interceptors/http-session.intcp';
import {HttpErrorInterceptor} from '../interceptors/http-error.intcp';

Vue.http.interceptors.push(HttpAuthInterceptor);
Vue.http.interceptors.push(HttpSessionInterceptor);
Vue.http.interceptors.push(HttpErrorInterceptor);

if (process.env.NODE_ENV !== 'production') {
	import(/* webpackChunkName: "dev" */ '../interceptors/http-mock-data.intcp').then(HttpMockDataInterceptor => {
		Vue.http.interceptors.push(HttpMockDataInterceptor['HttpMockDataInterceptor']);
	});
}



export default {

	async 'get' (url, options) {
		return await Vue.http.get(url, options);
	},

	async 'post' (url, body, options) {
		return await Vue.http.post(url, body, options);
	},

	async 'del' (url, options) {
		return await Vue.http['delete'](url, options);
	},

	async 'put' (url, body, options) {
		return await Vue.http.put(url, body, options);
	}

};
